<?php

namespace app\api\validate;

use think\Validate;
/**
 *
 * 未完成
 */
class RefundScene extends Validate
{
    protected $rule = [
        'id' => ["require","number"],
        'applicant_name' => ['require','length'=>'1,10'],
        "price" => ['float','require'],
        "refund_reason" => ['length'=>'0,100','require'],
        "status" => ['number','require'],
        "unpack_time" => ['require'],
        "unpack_name" => ['require','length'=>'1,10'],
        "unpack_telephone" => ['regex'=>'/^1[3-9]{1}[0-9]{9}$/','require'],
        "unpack_goods_name" => ['require','length'=>'1,20'],
        "order_time" => ['require'],
        "record_name" => ['number','require'],
        "record_telephone" => ['regex'=>'/^1[3-9]{1}[0-9]{9}$/','require'],
        "record_goods" => ['number','require'],
        "record_price" => ['float','require'],
        "data_state" => ['number','require'],
        'id.require' => '退款ID不能为空',
        'id.number' => '退款ID只能为数值',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'applicant_name.require' => '申请人不能为空',
        'applicant_name.length' => '申请人长度为1-10个字符',
        'price.float' => '价格只能为数值',
        'price.require' => '金额不能为空',
        'refund_reason.require' => '退款原因不能为空',
        'refund_reason.length' => '退款原因不能超过100个字符',
        'unpack_time.require' => '拆包时间不能为空',
        'unpack_name.require' => '拆包姓名不能为空',
        'unpack_name.length' => '拆包姓名长度为1-10个字符',
        'unpack_telephone.require' => '拆包人电话不能为空',
        'unpack_telephone.regex' => '拆包人电话格式不正确',
        'unpack_goods_name.require' => '拆包商品名称不能为空',
        'unpack_goods_name.length' => '拆包商品名称长度为1-20个字符',
        'order_time.require' => '下单时间不能为空',
        'record_name.require' => '录单姓名不能为空',
        'record_name.length' => '录单姓名长度为1-10个字符',
        'record_telephone.require' => '录单电话不能为空',
        'record_telephone.regex' => '录单电话格式不正确',
        'record_goods.require' => '录单商品不能为空',
        'record_goods.length' => '录单商品长度为1-20个字符',
        'record_price.require' => '录单金额不能为空',
        'record_price.float' => '录单金额只能为数值',
        'data_state.number' =>'数据状态必须为数值',
        'status.number' =>'审核状态必须为数值',
        'data_state.require' =>'未设置状态',
        'status.require' =>'审核状态不能为空',
    ];


    protected $scene = [
        'add'  =>  ['applicant_name',"price","refund_reason","status","unpack_time","unpack_name","unpack_telephone","unpack_goods_name","order_time","record_name","record_telephone","record_telephone","record_goods","record_price"],
        'update'  =>  ["id",'applicant_name',"price","refund_reason","status","unpack_time","unpack_name","unpack_telephone","unpack_goods_name","order_time","record_name","record_telephone","record_telephone","record_goods","record_price"],
        'update_state' => ['id',"data_state"],
        'update_status' => ['id','status']
    ];
}